package com.lsq.wuyuge.common.result;

/**
 * 响应码枚举类
 */
public enum ResultCode {
    SUCCESS(200, "操作成功"),
    FAILED(500, "操作失败"),
    VALIDATE_FAILED(400, "参数检验失败"),
    UNAUTHORIZED(401, "暂未登录或token已经过期"),
    FORBIDDEN(403, "没有相关权限"),
    NOT_FOUND(404, "资源不存在"),    
    
    // 用户相关错误码 1000~1999
    USER_NOT_EXIST(1001, "用户不存在"),
    USERNAME_ALREADY_EXIST(1002, "用户名已存在"),
    PASSWORD_ERROR(1003, "密码错误"),
    USER_DISABLED(1004, "用户已被禁用"),
    
    // 文章相关错误码 2000~2999
    ARTICLE_NOT_EXIST(2001, "文章不存在"),
    ARTICLE_ALREADY_PUBLISHED(2002, "文章已发布"),
    ARTICLE_NOT_PUBLISHED(2003, "文章未发布"),
    ARTICLE_UPDATE_NOT_ALLOWED(2004, "不允许更新文章"),
    
    // 评论相关错误码 3000~3999
    COMMENT_NOT_EXIST(3001, "评论不存在"),
    COMMENT_DISABLED(3002, "评论已关闭"),
    COMMENT_DELETE_NOT_ALLOWED(3003, "不允许删除评论"),
    
    // 点赞相关错误码 4000~4999
    LIKE_ALREADY_EXIST(4001, "已经点赞过"),
    LIKE_NOT_EXIST(4002, "点赞不存在"),
    
    // 其他错误码
    SYSTEM_ERROR(9999, "系统内部错误");

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
} 